Imports System
Imports System.Configuration
'Imports System.Data
Imports System.XML
'Imports System.Web
Imports System.Collections.Generic
Imports DotNetNuke
'Imports DotNetNuke.Services.Search
Imports DotNetNuke.Common.Utilities.XmlUtils
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Common.Globals
Imports DotNetNuke.Common
Imports DotNetNuke.Services.Localization


Namespace SGW.ComunicadorWeb

    Public Class ComunicadorWebController
        Inherits Entities.Modules.PortalModuleBase

#Region "Public methods"

        Public Function GetComunicadorWebs(ByVal PortalId As Integer, ByVal UserId As Integer) As List(Of ComunicadorWebInfo)

            Return CBO.FillCollection(Of ComunicadorWebInfo)(DataProvider.Instance().GetComunicadorWebs(PortalId, UserId))

        End Function
        Public Function GetComunicadorWebsActivos(ByVal PortalId As Integer, ByVal UserId As Integer) As List(Of ComunicadorWebInfo)

            Return CBO.FillCollection(Of ComunicadorWebInfo)(DataProvider.Instance().GetComunicadorWebsActivos(PortalId, UserId))

        End Function
        Public Function GetComunicadorWebsCerrados(ByVal PortalId As Integer, ByVal UserId As Integer, ByVal PageSize As Integer, ByVal CurrentPage As Integer) As List(Of ComunicadorWebInfo)

            Return CBO.FillCollection(Of ComunicadorWebInfo)(DataProvider.Instance().GetComunicadorWebsCerrados(PortalId, UserId, PageSize, CurrentPage))

        End Function


        'Public Function GetComunicadorWebsSorted(ByVal PortalId As Integer, ByVal UserID As Integer, ByVal OrderClause As String) As List(Of ComunicadorWebInfo)

        '    Return CBO.FillCollection(Of ComunicadorWebInfo)(DataProvider.Instance().GetComunicadorWebsSorted(PortalId, UserID, OrderClause))

        'End Function

        Public Function GetAllComunicadorWebs(ByVal Portalid As Integer) As List(Of ComunicadorWebInfo)

            Return CBO.FillCollection(Of ComunicadorWebInfo)(DataProvider.Instance().GetAllComunicadorWebs(Portalid))

        End Function


        'Public Function GetAllComunicadorWebsSorted(ByVal Portalid As Integer, ByVal OrderClause As String) As List(Of ComunicadorWebInfo)

        '    Return CBO.FillCollection(Of ComunicadorWebInfo)(DataProvider.Instance().GetAllComunicadorWebsSorted(Portalid, OrderClause))

        'End Function

        Public Function GetComunicadorWeb(ByVal PortalId As Integer, ByVal HiloID As Integer) As ComunicadorWebInfo

            Return CType(CBO.FillObject(DataProvider.Instance().GetComunicadorWeb(PortalId, HiloID), GetType(ComunicadorWebInfo)), ComunicadorWebInfo)

        End Function

        Public Sub enviarcorreo()

        End Sub

        Public Function AddComunicadorWeb(ByVal objComunicadorWeb As ComunicadorWebInfo) As Integer

            Dim objComunicadorcfgs As New SGW_ConfiguracionController
            Dim strdifhoras As String = objComunicadorcfgs.GetSGW_ConfiguracionBycfg_Descripcion(PortalId, "SGWComunicadorWeb_DiferenciaHoraria")
            Dim DblHoras As Double
            If strdifhoras.Length > 0 Then
                DblHoras = CDbl(strdifhoras)
            Else
                DblHoras = 0
            End If

            Return DataProvider.Instance().AddComunicadorWeb(objComunicadorWeb.PortalId, objComunicadorWeb.Hil_FechaCreacion.AddHours(DblHoras), objComunicadorWeb.Hil_Status, objComunicadorWeb.Hil_UsuarioID, objComunicadorWeb.Hil_IDUltimoMensaje, objComunicadorWeb.Hil_Cerrado, objComunicadorWeb.Hil_FechaCierre, objComunicadorWeb.Hil_PrioridadId, objComunicadorWeb.Hil_CategoriaID, objComunicadorWeb.Hil_SubCategoriaID, objComunicadorWeb.Hil_Asunto)


        End Function

        'Public Sub AddComunicadorWeb(ByVal PortalId As Integer, ByVal HiloID As Int32, ByVal Hil_FechaCreacion As DateTime, ByVal Hil_Status As Int32, ByVal Hil_UsuarioID As Int32, ByVal Hil_IDUltimoMensaje As Int32, ByVal Hil_Cerrado As Boolean, ByVal Hil_FechaCierre As DateTime, ByVal Hil_PrioridadId As Int32, ByVal Hil_CategoriaID As Int32, ByVal Hil_SubCategoriaID As Int32, ByVal Hil_Asunto As String)


        '    DataProvider.Instance().AddComunicadorWeb(PortalId, Hil_FechaCreacion, Hil_Status, Hil_UsuarioID, Hil_IDUltimoMensaje, Hil_Cerrado, Hil_FechaCierre, Hil_PrioridadId, Hil_CategoriaID, Hil_SubCategoriaID, Hil_Asunto)


        'End Sub

        Public Sub UpdateComunicadorWeb(ByVal objComunicadorWeb As ComunicadorWebInfo)

            Dim objComunicadorcfgs As New SGW_ConfiguracionController
            Dim strdifhoras As String = objComunicadorcfgs.GetSGW_ConfiguracionBycfg_Descripcion(PortalId, "SGWComunicadorWeb_DiferenciaHoraria")
            Dim DblHoras As Double
            If strdifhoras.Length > 0 Then
                DblHoras = CDbl(strdifhoras)
            Else
                DblHoras = 0
            End If
            If objComunicadorWeb.Hil_FechaCierre <> Null.NullDate Then objComunicadorWeb.Hil_FechaCierre.AddHours(DblHoras)
            DataProvider.Instance().UpdateComunicadorWeb(objComunicadorWeb.PortalId, objComunicadorWeb.HiloID, objComunicadorWeb.Hil_FechaCreacion, objComunicadorWeb.Hil_Status, objComunicadorWeb.Hil_UsuarioID, objComunicadorWeb.Hil_IDUltimoMensaje, objComunicadorWeb.Hil_Cerrado, objComunicadorWeb.Hil_FechaCierre, objComunicadorWeb.Hil_PrioridadId, objComunicadorWeb.Hil_CategoriaID, objComunicadorWeb.Hil_SubCategoriaID, objComunicadorWeb.Hil_Asunto)


        End Sub

        'Public Sub UpdateComunicadorWeb(ByVal PortalId As Integer, ByVal HiloID As Int32, ByVal Hil_FechaCreacion As DateTime, ByVal Hil_Status As Int32, ByVal Hil_UsuarioID As Int32, ByVal Hil_IDUltimoMensaje As Int32, ByVal Hil_Cerrado As Boolean, ByVal Hil_FechaCierre As DateTime, ByVal Hil_PrioridadId As Int32, ByVal Hil_CategoriaID As Int32, ByVal Hil_SubCategoriaID As Int32, ByVal Hil_Asunto As String)

        '    DataProvider.Instance().UpdateComunicadorWeb(PortalId, HiloID, Hil_FechaCreacion, Hil_Status, Hil_UsuarioID, Hil_IDUltimoMensaje, Hil_Cerrado, Hil_FechaCierre, Hil_PrioridadId, Hil_CategoriaID, Hil_SubCategoriaID, Hil_Asunto)


        'End Sub

        Public Sub DeleteComunicadorWeb(ByVal PortalId As Integer, ByVal HiloID As Integer)

            DataProvider.Instance().DeleteComunicadorWeb(PortalId, HiloID)

        End Sub

        Public Function GetAllComunicadorWebsActivos(ByVal Portalid As Integer) As List(Of ComunicadorWebInfo)

            Return CBO.FillCollection(Of ComunicadorWebInfo)(DataProvider.Instance().GetAllComunicadorWebsActivos(Portalid))

        End Function

        Public Function CountAllComunicadorWebsActivos(ByVal Portalid As Integer) As Integer
            Return DataProvider.Instance.CountAllComunicadorWebsActivos(Portalid)
        End Function

        Public Function CountAllComunicadorWebsCerrados(ByVal Portalid As Integer) As Integer
            Return DataProvider.Instance.CountAllComunicadorWebsCerrados(Portalid)
        End Function

        Public Function CountComunicadorWebsCerrados(ByVal Portalid As Integer, ByVal UserID As String) As Integer
            Return DataProvider.Instance.CountComunicadorWebsCerrados(Portalid, UserID)
        End Function

        Public Function GetAllComunicadorWebsCerrados(ByVal Portalid As Integer, ByVal PageSize As Integer, ByVal CurrentPage As Integer) As List(Of ComunicadorWebInfo)

            Return CBO.FillCollection(Of ComunicadorWebInfo)(DataProvider.Instance().GetAllComunicadorWebsCerrados(Portalid, PageSize, CurrentPage))

        End Function



#End Region


    End Class

    <DataObject(True)> _
 Public Class SGW_PrioridadesController
        Inherits Entities.Modules.PortalModuleBase
        'Implements Entities.Modules.ISearchable
        'Implements Entities.Modules.IPortable

#Region "Public Methods"

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a SGW_Prioridades from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_Prioridades(ByVal pri_ID As Integer) As SGW_PrioridadesInfo
            Return CType(CBO.FillObject(DataProvider.Instance().GetSGW_Prioridades(pri_ID), GetType(SGW_PrioridadesInfo)), SGW_PrioridadesInfo)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_Prioridadess from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_PrioridadesByPri_PortalID() As List(Of SGW_PrioridadesInfo)
            Return CBO.FillCollection(Of SGW_PrioridadesInfo)(DataProvider.Instance().GetSGW_PrioridadesByPri_PortalID(Me.PortalId))
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' adds a new SGW_Prioridades to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Insert)> _
  Public Function AddSGW_Prioridades(ByVal objSGW_Prioridades As SGW_PrioridadesInfo) As Integer
            Return DataProvider.Instance().AddSGW_Prioridades(Me.PortalId, objSGW_Prioridades.Pri_Nombre, objSGW_Prioridades.Pri_Peso)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' saves a SGW_Prioridades to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Update)> _
  Public Sub UpdateSGW_Prioridades(ByVal objSGW_Prioridades As SGW_PrioridadesInfo)
            DataProvider.Instance().UpdateSGW_Prioridades(objSGW_Prioridades.Pri_ID, Me.PortalId, objSGW_Prioridades.Pri_Nombre, objSGW_Prioridades.Pri_Peso)
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' deletes a SGW_Prioridades from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Delete)> _
  Public Sub DeleteSGW_Prioridades(ByVal objSGW_Prioridades As SGW_PrioridadesInfo)
            DataProvider.Instance().DeleteSGW_Prioridades(objSGW_Prioridades.Pri_ID)
        End Sub

#End Region

#Region "Optional Interfaces"
        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' GetSearchItems implements the ISearchable Interface
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        'Public Function GetSearchItems(ByVal ModInfo As Entities.Modules.ModuleInfo) As DotNetNuke.Services.Search.SearchItemInfoCollection Implements DotNetNuke.Entities.Modules.ISearchable.GetSearchItems

        '    Dim SearchItemCollection As New SearchItemInfoCollection
        '    ' Add Implementation Details Here
        '    Return SearchItemCollection

        'End Function
        '''' -----------------------------------------------------------------------------
        '''' <summary>
        '''' ExportModule implements the IPortable ExportModule Interface
        '''' </summary>
        '''' <remarks>
        '''' </remarks>
        '''' <history>
        '''' </history>
        '''' -----------------------------------------------------------------------------
        'Public Function ExportModule(ByVal ModuleID As Integer) As String Implements DotNetNuke.Entities.Modules.IPortable.ExportModule

        '    Dim strXML As String = ""
        '    ' Add Implementation Details Here
        '    Return strXML

        'End Function

        '''' -----------------------------------------------------------------------------
        '''' <summary>
        '''' ImportModule implements the IPortable ImportModule Interface
        '''' </summary>
        '''' <remarks>
        '''' </remarks>
        '''' <history>
        '''' </history>
        '''' -----------------------------------------------------------------------------
        'Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserId As Integer) Implements DotNetNuke.Entities.Modules.IPortable.ImportModule
        '    ' Add Implementation Details Here
        'End Sub
#End Region
    End Class

    <DataObject(True)> _
Public Class SGW_CategoriasController
        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a SGW_Categorias from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_Categorias(ByVal iDCategoria As Integer) As SGW_CategoriasInfo
            Return CType(CBO.FillObject(DataProvider.Instance().GetSGW_Categorias(iDCategoria), GetType(SGW_CategoriasInfo)), SGW_CategoriasInfo)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_Categoriass from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetAllSGW_Categoriass(ByVal portalid As Integer) As List(Of SGW_CategoriasInfo)
            Return CBO.FillCollection(Of SGW_CategoriasInfo)(DataProvider.Instance().GetAllSGW_Categoriass(portalid))
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' adds a new SGW_Categorias to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Insert)> _
  Public Function AddSGW_Categorias(ByVal objSGW_Categorias As SGW_CategoriasInfo) As Integer
            Return DataProvider.Instance().AddSGW_Categorias(objSGW_Categorias.PortalID, objSGW_Categorias.Descripcion)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' saves a SGW_Categorias to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Update)> _
  Public Sub UpdateSGW_Categorias(ByVal objSGW_Categorias As SGW_CategoriasInfo)
            DataProvider.Instance().UpdateSGW_Categorias(objSGW_Categorias.IDCategoria, objSGW_Categorias.PortalID, objSGW_Categorias.Descripcion)
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' deletes a SGW_Categorias from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Delete)> _
  Public Sub DeleteSGW_Categorias(ByVal objSGW_Categorias As SGW_CategoriasInfo)
            DataProvider.Instance().DeleteSGW_Categorias(objSGW_Categorias.IDCategoria)
        End Sub

    End Class

    <DataObject(True)> _
 Public Class SGW_SubCategoriasController
        Inherits Entities.Modules.PortalModuleBase
        'Implements Entities.Modules.ISearchable
        'Implements Entities.Modules.IPortable

#Region "Public Methods"

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a SGW_SubCategorias from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_SubCategorias(ByVal iDSubcategoria As Integer) As SGW_SubCategoriasInfo
            Return CType(CBO.FillObject(DataProvider.Instance().GetSGW_SubCategorias(iDSubcategoria), GetType(SGW_SubCategoriasInfo)), SGW_SubCategoriasInfo)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_SubCategoriass from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_SubCategoriasBySC_PortalID(ByVal sC_PortalID As Integer) As List(Of SGW_SubCategoriasInfo)
            Return CBO.FillCollection(Of SGW_SubCategoriasInfo)(DataProvider.Instance().GetSGW_SubCategoriasBySC_PortalID(sC_PortalID))
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_SubCategoriass from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_SubCategoriasBySC_CategoriaID(ByVal SC_CategoriaID As String) As SqlDataReader
            Return DataProvider.Instance().GetSGW_SubCategoriasBySC_CategoriaID(SC_CategoriaID)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_SubCategoriass from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetAllSGW_SubCategoriass() As List(Of SGW_SubCategoriasInfo)
            Return CBO.FillCollection(Of SGW_SubCategoriasInfo)(DataProvider.Instance().GetAllSGW_SubCategoriass())
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' adds a new SGW_SubCategorias to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Insert)> _
  Public Function AddSGW_SubCategorias(ByVal objSGW_SubCategorias As SGW_SubCategoriasInfo) As Integer
            Return DataProvider.Instance().AddSGW_SubCategorias(Me.PortalId, objSGW_SubCategorias.SC_CategoriaID, objSGW_SubCategorias.Sc_Descripcion)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' saves a SGW_SubCategorias to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Update)> _
  Public Sub UpdateSGW_SubCategorias(ByVal objSGW_SubCategorias As SGW_SubCategoriasInfo)
            DataProvider.Instance().UpdateSGW_SubCategorias(objSGW_SubCategorias.IDSubcategoria, objSGW_SubCategorias.SC_PortalID, objSGW_SubCategorias.SC_CategoriaID, objSGW_SubCategorias.Sc_Descripcion)
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' deletes a SGW_SubCategorias from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Delete)> _
  Public Sub DeleteSGW_SubCategorias(ByVal objSGW_SubCategorias As SGW_SubCategoriasInfo)
            DataProvider.Instance().DeleteSGW_SubCategorias(objSGW_SubCategorias.IDSubcategoria)
        End Sub

#End Region

#Region "Optional Interfaces"
        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' GetSearchItems implements the ISearchable Interface
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        'Public Function GetSearchItems(ByVal ModInfo As Entities.Modules.ModuleInfo) As DotNetNuke.Services.Search.SearchItemInfoCollection Implements DotNetNuke.Entities.Modules.ISearchable.GetSearchItems

        '    Dim SearchItemCollection As New SearchItemInfoCollection
        '    ' Add Implementation Details Here
        '    Return SearchItemCollection

        'End Function
        '''' -----------------------------------------------------------------------------
        '''' <summary>
        '''' ExportModule implements the IPortable ExportModule Interface
        '''' </summary>
        '''' <remarks>
        '''' </remarks>
        '''' <history>
        '''' </history>
        '''' -----------------------------------------------------------------------------
        'Public Function ExportModule(ByVal ModuleID As Integer) As String Implements DotNetNuke.Entities.Modules.IPortable.ExportModule

        '    Dim strXML As String = ""
        '    ' Add Implementation Details Here
        '    Return strXML

        'End Function

        '''' -----------------------------------------------------------------------------
        '''' <summary>
        '''' ImportModule implements the IPortable ImportModule Interface
        '''' </summary>
        '''' <remarks>
        '''' </remarks>
        '''' <history>
        '''' </history>
        '''' -----------------------------------------------------------------------------
        'Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserId As Integer) Implements DotNetNuke.Entities.Modules.IPortable.ImportModule
        '    ' Add Implementation Details Here
        'End Sub
#End Region
    End Class

    <DataObject(True)> _
 Public Class SGW_MensajesController
        Inherits Entities.Modules.PortalModuleBase
        'Implements Entities.Modules.ISearchable
        'Implements Entities.Modules.IPortable

#Region "Public Methods"

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a SGW_Mensajes from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_Mensajes(ByVal mensajeID As Integer) As SGW_MensajesInfo
            Return CType(CBO.FillObject(DataProvider.Instance().GetSGW_Mensajes(mensajeID), GetType(SGW_MensajesInfo)), SGW_MensajesInfo)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_Mensajess from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_MensajesByMen_HiloID(ByVal men_HiloID As Integer) As List(Of SGW_MensajesInfo)
            Return CBO.FillCollection(Of SGW_MensajesInfo)(DataProvider.Instance().GetSGW_MensajesByMen_HiloID(men_HiloID))
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_Mensajess from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetAllSGW_Mensajess() As List(Of SGW_MensajesInfo)
            Return CBO.FillCollection(Of SGW_MensajesInfo)(DataProvider.Instance().GetAllSGW_Mensajess())
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' adds a new SGW_Mensajes to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Insert)> _
  Public Function AddSGW_Mensajes(ByVal objSGW_Mensajes As SGW_MensajesInfo) As Integer
            Dim objComunicadorcfgs As New SGW_ConfiguracionController
            Dim strdifhoras As String = objComunicadorcfgs.GetSGW_ConfiguracionBycfg_Descripcion(PortalId, "SGWComunicadorWeb_DiferenciaHoraria")
            Dim DblHoras As Double
            If strdifhoras.Length > 0 Then
                DblHoras = CDbl(strdifhoras)
            Else
                DblHoras = 0
            End If

            Return DataProvider.Instance().AddSGW_Mensajes(objSGW_Mensajes.Men_Portal, objSGW_Mensajes.Men_UsuarioID, objSGW_Mensajes.Men_HiloID, objSGW_Mensajes.Men_FechaMensaje.AddHours(DblHoras), objSGW_Mensajes.Men_Mensaje, objSGW_Mensajes.Men_IpDesde)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' saves a SGW_Mensajes to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Update)> _
  Public Sub UpdateSGW_Mensajes(ByVal objSGW_Mensajes As SGW_MensajesInfo)
            DataProvider.Instance().UpdateSGW_Mensajes(objSGW_Mensajes.MensajeID, objSGW_Mensajes.Men_Portal, objSGW_Mensajes.Men_UsuarioID, objSGW_Mensajes.Men_HiloID, objSGW_Mensajes.Men_FechaMensaje, objSGW_Mensajes.Men_Mensaje, objSGW_Mensajes.Men_IpDesde)
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' deletes a SGW_Mensajes from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Delete)> _
  Public Sub DeleteSGW_Mensajes(ByVal objSGW_Mensajes As SGW_MensajesInfo)
            DataProvider.Instance().DeleteSGW_Mensajes(objSGW_Mensajes.MensajeID)
        End Sub

#End Region

#Region "Optional Interfaces"
        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' GetSearchItems implements the ISearchable Interface
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        'Public Function GetSearchItems(ByVal ModInfo As Entities.Modules.ModuleInfo) As DotNetNuke.Services.Search.SearchItemInfoCollection Implements DotNetNuke.Entities.Modules.ISearchable.GetSearchItems

        '    Dim SearchItemCollection As New SearchItemInfoCollection
        '    ' Add Implementation Details Here
        '    Return SearchItemCollection

        'End Function
        '''' -----------------------------------------------------------------------------
        '''' <summary>
        '''' ExportModule implements the IPortable ExportModule Interface
        '''' </summary>
        '''' <remarks>
        '''' </remarks>
        '''' <history>
        '''' </history>
        '''' -----------------------------------------------------------------------------
        'Public Function ExportModule(ByVal ModuleID As Integer) As String Implements DotNetNuke.Entities.Modules.IPortable.ExportModule

        '    Dim strXML As String = ""
        '    ' Add Implementation Details Here
        '    Return strXML

        'End Function

        '''' -----------------------------------------------------------------------------
        '''' <summary>
        '''' ImportModule implements the IPortable ImportModule Interface
        '''' </summary>
        '''' <remarks>
        '''' </remarks>
        '''' <history>
        '''' </history>
        '''' -----------------------------------------------------------------------------
        'Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserId As Integer) Implements DotNetNuke.Entities.Modules.IPortable.ImportModule
        '    ' Add Implementation Details Here
        'End Sub
#End Region
    End Class

    <DataObject(True)> _
 Public Class SGW_ConfiguracionController
        'Implements Entities.Modules.ISearchable
        'Implements Entities.Modules.IPortable

#Region "Public Methods"

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a SGW_Configuracion from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_Configuracion(ByVal idConfig As Integer) As SGW_ConfiguracionInfo
            Return CType(CBO.FillObject(DataProvider.Instance().GetSGW_Configuracion(idConfig), GetType(SGW_ConfiguracionInfo)), SGW_ConfiguracionInfo)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_Configuracions from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetSGW_ConfiguracionBycfg_Descripcion(ByVal Portalid As Integer, ByVal cfg_Descripcion As String) As String

            Dim valor As String

            Dim idconfig As Integer = SGW.ComunicadorWeb.DataProvider.Instance.GetSGW_ConfiguracionIDBycfg_Descripcion(Portalid, cfg_Descripcion)

            If idconfig = 0 Then
                DataProvider.Instance().AddSGW_Configuracion(Portalid, cfg_Descripcion, "")
            End If

            valor = DataProvider.Instance().GetSGW_ConfiguracionBycfg_Descripcion(Portalid, cfg_Descripcion)

            Return valor

        End Function

        Public Function usuarioestaenunodelosgrupos(ByVal UsuarioInfo As UserInfo, ByVal GruposQuePuedenResponder As String) As Boolean

            Dim valores() As String = Split(GruposQuePuedenResponder, "|")
            Dim valor As String
            Dim result As Boolean = False

            Dim cont As Integer = 0

            For Each valor In valores(cont)
                If UsuarioInfo.IsInRole(valores(cont)) Then
                    result = True
                    Exit For
                End If

                If cont + 1 < valores.Length Then
                    cont = cont + 1
                Else
                    Exit For
                End If
            Next

            Return result

        End Function



        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' retrieves a collection of SGW_Configuracions from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Select)> _
  Public Function GetAllSGW_Configuracions(ByVal Portalid As Integer) As List(Of SGW_ConfiguracionInfo)
            Return CBO.FillCollection(Of SGW_ConfiguracionInfo)(DataProvider.Instance().GetAllSGW_Configuracions(Portalid))
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' adds a new SGW_Configuracion to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Insert)> _
  Public Function AddSGW_Configuracion(ByVal objSGW_Configuracion As SGW_ConfiguracionInfo) As Integer
            Return DataProvider.Instance().AddSGW_Configuracion(objSGW_Configuracion.cfg_PortalID, objSGW_Configuracion.cfg_Descripcion, objSGW_Configuracion.cfg_Valor)
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' saves a SGW_Configuracion to the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Update)> _
  Public Sub UpdateSGW_Configuracion(ByVal objSGW_Configuracion As SGW_ConfiguracionInfo)
            DataProvider.Instance().UpdateSGW_Configuracion(objSGW_Configuracion.IdConfig, objSGW_Configuracion.cfg_PortalID, objSGW_Configuracion.cfg_Descripcion, objSGW_Configuracion.cfg_Valor)
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' deletes a SGW_Configuracion from the database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        <DataObjectMethod(DataObjectMethodType.Delete)> _
  Public Sub DeleteSGW_Configuracion(ByVal objSGW_Configuracion As SGW_ConfiguracionInfo)
            DataProvider.Instance().DeleteSGW_Configuracion(objSGW_Configuracion.IdConfig)
        End Sub

#End Region

#Region "Optional Interfaces"
        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' GetSearchItems implements the ISearchable Interface
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        'Public Function GetSearchItems(ByVal ModInfo As Entities.Modules.ModuleInfo) As DotNetNuke.Services.Search.SearchItemInfoCollection Implements DotNetNuke.Entities.Modules.ISearchable.GetSearchItems

        '    Dim SearchItemCollection As New SearchItemInfoCollection
        '    ' Add Implementation Details Here
        '    Return SearchItemCollection

        'End Function
        '''' -----------------------------------------------------------------------------
        '''' <summary>
        '''' ExportModule implements the IPortable ExportModule Interface
        '''' </summary>
        '''' <remarks>
        '''' </remarks>
        '''' <history>
        '''' </history>
        '''' -----------------------------------------------------------------------------
        'Public Function ExportModule(ByVal ModuleID As Integer) As String Implements DotNetNuke.Entities.Modules.IPortable.ExportModule

        '    Dim strXML As String = ""
        '    ' Add Implementation Details Here
        '    Return strXML

        'End Function

        '''' -----------------------------------------------------------------------------
        '''' <summary>
        '''' ImportModule implements the IPortable ImportModule Interface
        '''' </summary>
        '''' <remarks>
        '''' </remarks>
        '''' <history>
        '''' </history>
        '''' -----------------------------------------------------------------------------
        'Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserId As Integer) Implements DotNetNuke.Entities.Modules.IPortable.ImportModule
        '    ' Add Implementation Details Here
        'End Sub
#End Region
    End Class
End Namespace